package ldh.im.fxbase.richtext.item;

import javafx.scene.Node;
import ldh.im.fxbase.component.FileCell;
import ldh.im.fxbase.component.VideoCell;
import ldh.im.fxbase.richtext.TextItem;
import ldh.im.fxbase.richtext.TextItemType;

import java.io.File;

public class VideoTextItem extends TextItem<VideoTextItem> {

    private File file;

    public VideoTextItem() {}

    public VideoTextItem(File file) {
        this.file = file;
    }

    public Node createNode() {
        return new VideoCell(file);
    }

    public TextItemType getTextItemType() {
        return TextItemType.video;
    }

    public String getStyle() {
        return "file";
    }

    public File getFile() {
        return file;
    }

    @Override
    public boolean isNull() {
        return file == null;
    }

    @Override
    public String getData() {
        return getFile().getPath();
    }
}
